package cn.gok.homework;

import java.util.Random;
import java.util.Scanner;

public class Homework1 {
    public static void main(String[] args) {
        String str = 产生并输出随机密码();
    }
    private static String 产生并输出随机密码() {
        System.out.println("请输入密码长度：大于等于6");
        int n = new Scanner(System.in).nextInt();
        char cs[] = new char[n];
        for (int i = 0; i < n; i++) {
            int x = new Random().nextInt(2);
            if (x == 1) {
                int num = new Random().nextInt(10);
                cs[i] = (char) (num + '0');
            } else {
                int chars = new Random().nextInt(26);
                cs[i] = (char) ('A' + chars);
            }
        }
        String str = new String(cs);
        System.out.println(str);
        return str;
    }
}